import { reqGetBannerList, reqGetCategoryList } from '@/api'


const state = {
    categoryList: [],
    bannerList:[]
};

const actions = {
    async categoryList({ commit }) {
        let result = await reqGetCategoryList();
        if (result.code == 200) {
            commit('CATEGORYLIST', result.data)
        }
    },

    async getBannerList({ commit }) {
        let result = await reqGetBannerList();
        if (result.code == 200) {
            commit('GETBANNERLIST', result.data)
        }


    }
};

const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList;
    },

    GETBANNERLIST(state, bannerList) {
        state.bannerList = bannerList;

    }

};
const getters = {};

export default ({
    state,
    actions,
    mutations,
    getters

})